#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QSerialPort>
#include <QStandardItem>
#include <QStandardItemModel>
#include <QLabel>
#include <QThread>

#include "settingsdialog.h"
#include "fashionstarservo.h"

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

signals:
    void setAngle(uint8_t id, double angle, uint16_t interval, uint16_t power);
    void startMoving();
    void stopMoving();

private slots:
    void onActionOpenCloseSerial(void);
    void onBtnScanDivce();
    void onBtnSet();
    void onBtnStart();
//    void onDSpinAngleChanged(double value);


private:
    void initTableView();
    void showStatusMessage(const QString &message);


private:
    Ui::MainWindow *ui;
    QSerialPort *m_serial;
    SettingsDialog *m_settings;
    FashionStarServo *m_fashion;
    QStandardItemModel *m_model;
    QLabel *m_status;
    QThread *fashionThread;
};

#endif // MAINWINDOW_H
